<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Texture</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
    <script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">

<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
            
                <h1><img src="../assets/css/logo.png" title=""></h1>
            
        </div>
        <div class="yui3-u-1-4 version">
            <em>API Docs for: </em>
        </div>
    </div>
    <div id="bd" class="yui3-g">

        <div class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
    <h2 class="off-left">APIs</h2>
    <div id="api-tabview" class="tabview">
        <ul class="tabs">
            <li><a href="#api-classes">Classes</a></li>
            <li><a href="#api-modules">Modules</a></li>
        </ul>

        <div id="api-tabview-filter">
            <input type="search" id="api-filter" placeholder="Type to filter APIs">
        </div>

        <div id="api-tabview-panel">
            <ul id="api-classes" class="apis classes">
            
                <li><a href="../classes/BBox.html">BBox</a></li>
            
                <li><a href="../classes/Buffer.html">Buffer</a></li>
            
                <li><a href="../classes/geo.html">geo</a></li>
            
                <li><a href="../classes/GL.html">GL</a></li>
            
                <li><a href="../classes/Indexer.html">Indexer</a></li>
            
                <li><a href="../classes/LEvent.html">LEvent</a></li>
            
                <li><a href="../classes/Mesh.html">Mesh</a></li>
            
                <li><a href="../classes/Octree.html">Octree</a></li>
            
                <li><a href="../classes/Shader.html">Shader</a></li>
            
                <li><a href="../classes/Texture.html">Texture</a></li>
            
            </ul>

            <ul id="api-modules" class="apis modules">
            
            </ul>
        </div>
    </div>
</div>

            </div>
        </div>
        <div class="yui3-u-3-4">
                <div id="api-options">
        Show:
        <label for="api-show-inherited">
            <input type="checkbox" id="api-show-inherited" checked>
            Inherited
        </label>

        <label for="api-show-protected">
            <input type="checkbox" id="api-show-protected">
            Protected
        </label>

        <label for="api-show-private">
            <input type="checkbox" id="api-show-private">
            Private
        </label>
        <label for="api-show-deprecated">
            <input type="checkbox" id="api-show-deprecated">
            Deprecated
        </label>

    </div>


            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
                        <h1>Texture Class</h1>
<div class="box meta">
    

    

    
        <div class="foundat">
            Defined in: <a href="../files/.._src_texture.js.html#l1"><code>..&#x2F;src&#x2F;texture.js:1</code></a>
        </div>
    

    

    
</div>



<div class="box intro">
    <p>Texture class to upload images to the GPU, default is gl.TEXTURE_2D, gl.RGBAof gl.UNSIGNED_BYTE with filter gl.LINEAR, and gl.CLAMP_TO_EDGE</p>
<pre class="code prettyprint"><code>There is a list of options
==========================
- texture_type: gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP
- format: gl.RGB, gl.RGBA, gl.DEPTH_COMPONENT
- type: gl.UNSIGNED_BYTE, gl.UNSIGNED_SHORT, gl.HALF_FLOAT_OES, gl.FLOAT
- filter: filtering for mag and min: gl.NEAREST or gl.LINEAR
- magFilter: magnifying filter: gl.NEAREST, gl.LINEAR
- minFilter: minifying filter: gl.NEAREST, gl.LINEAR, gl.LINEAR_MIPMAP_LINEAR
- premultiply_alpha: multiplies alpha channel by every color channel
- wrap: texture wrapping: gl.CLAMP_TO_EDGE, gl.REPEAT, gl.MIRROR</code></pre>

</div>


    <div class="constructor">
        <h2>Constructor</h2>
        <div id="method_Texture" class="method item">
    <h3 class="name"><code>Texture</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>width</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>height</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>options</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l1"><code>..&#x2F;src&#x2F;texture.js:1</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        
    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">width</code>
                        <span class="type">Number</span>
                    

                    

                    <div class="param-description">
                        <p>texture width (any supported but Power of Two allows to have mipmaps), 0 means no memory reserved till its filled</p>

                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">height</code>
                        <span class="type">Number</span>
                    

                    

                    <div class="param-description">
                        <p>texture height (any supported but Power of Two allows to have mipmaps), 0 means no memory reserved till its filled</p>

                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">options</code>
                        <span class="type">Object</span>
                    

                    

                    <div class="param-description">
                        <p>Check the list in the description</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    

    
</div>

    </div>


<div id="classdocs" class="tabview">
    <ul class="api-class-tabs">
        <li class="api-class-tab index"><a href="#index">Index</a></li>

        
            <li class="api-class-tab methods"><a href="#methods">Methods</a></li>
        
        
        
        
    </ul>

    <div>
        <div id="index" class="api-class-tabpanel index">
            <h2 class="off-left">Item Index</h2>

            
                <div class="index-section methods">
                    <h3>Methods</h3>

                    <ul class="index-list methods">
                        
                            <li class="index-item method">
                                <a href="#method_applyBlur">applyBlur</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_bind">bind</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_copyTo">copyTo</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_drawTo">drawTo</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_drawToColorAndDepth">drawToColorAndDepth</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_generateMetadata">generateMetadata</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_isDepthSupported">isDepthSupported</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_Texture.cubemapFromImage">Texture.cubemapFromImage</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_Texture.cubemapFromImages">Texture.cubemapFromImages</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_Texture.fromImage">Texture.fromImage</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_Texture.fromTexture">Texture.fromTexture</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_Texture.fromTexture">Texture.fromTexture</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_Texture.fromURL">Texture.fromURL</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_Texture.fromVideo">Texture.fromVideo</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_Texture.toBase64">Texture.toBase64</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_Texture.toBlob">Texture.toBlob</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_toCanvas">toCanvas</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_toViewport">toViewport</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_unbind">unbind</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_uploadData">uploadData</a>

                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_uploadImage">uploadImage</a>

                                
                                
                            </li>
                        
                    </ul>
                </div>
            

            

            

            
        </div>

        
            <div id="methods" class="api-class-tabpanel">
                <h2 class="off-left">Methods</h2>

                
                    <div id="method_applyBlur" class="method item">
    <h3 class="name"><code>applyBlur</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>offsetx</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>offsety</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>intensity</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>temp_texture</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l296"><code>..&#x2F;src&#x2F;texture.js:296</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Applies a blur filter of one pixel to the texture (be careful using it, it is slow)</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">offsetx</code>
                        <span class="type">Number</span>
                    

                    

                    <div class="param-description">
                        <p>scalar that multiplies the offset when fetching pixels horizontally (default 1)</p>

                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">offsety</code>
                        <span class="type">Number</span>
                    

                    

                    <div class="param-description">
                        <p>scalar that multiplies the offset when fetching pixels vertically (default 1)</p>

                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">intensity</code>
                        <span class="type">Number</span>
                    

                    

                    <div class="param-description">
                        <p>scalar that multiplies the result (default 1)</p>

                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">temp_texture</code>
                        <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>
                    

                    

                    <div class="param-description">
                        <p>blur needs a temp texture, if not supplied it will create a new one each time!</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>:
                    
                    <p>returns the temp_texture in case you want to reuse it</p>

                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_bind" class="method item">
    <h3 class="name"><code>bind</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>unit</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type">Number</span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l106"><code>..&#x2F;src&#x2F;texture.js:106</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Binds the texture to one texture unit</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">unit</code>
                        <span class="type">Number</span>
                    

                    

                    <div class="param-description">
                        <p>texture unit</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Number</span>:
                    
                    <p>returns the texture unit</p>

                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_copyTo" class="method item">
    <h3 class="name"><code>copyTo</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>target_texture</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l228"><code>..&#x2F;src&#x2F;texture.js:228</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Copy content of one texture into another</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">target_texture</code>
                        <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    

    
</div>

                
                    <div id="method_drawTo" class="method item">
    <h3 class="name"><code>drawTo</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>callback</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l179"><code>..&#x2F;src&#x2F;texture.js:179</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Render to texture using FBO, just pass the callback to a rendering function and the content of the texture will be updated</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">callback</code>
                        <span class="type">Function</span>
                    

                    

                    <div class="param-description">
                        <p>function that does all the rendering inside this texture</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    

    
</div>

                
                    <div id="method_drawToColorAndDepth" class="method item">
    <h3 class="name"><code>drawToColorAndDepth</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>color_texture</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>depth_texture</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>callback</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l328"><code>..&#x2F;src&#x2F;texture.js:328</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Similar to drawTo but it also stores the depth in a depth texture</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">color_texture</code>
                        <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">depth_texture</code>
                        <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">callback</code>
                        <span class="type">Function</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    

    
</div>

                
                    <div id="method_generateMetadata" class="method item">
    <h3 class="name"><code>generateMetadata</code></h3>

    
        <span class="paren">()</span>
    

    
        <span class="returns-inline">
            <span class="type">Object</span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l635"><code>..&#x2F;src&#x2F;texture.js:635</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>generates some basic metadata about the image</p>

    </div>

    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Object</span>:
                    
                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_isDepthSupported" class="method item">
    <h3 class="name"><code>isDepthSupported</code></h3>

    
        <span class="paren">()</span>
    

    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l97"><code>..&#x2F;src&#x2F;texture.js:97</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Returns if depth texture is supported by the GPU</p>

    </div>

    

    

    
</div>

                
                    <div id="method_Texture.cubemapFromImage" class="method item">
    <h3 class="name"><code>Texture.cubemapFromImage</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>image</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>options</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l541"><code>..&#x2F;src&#x2F;texture.js:541</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Create a cubemap texture from a single image that contains all six images arranged vertically</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">image</code>
                        <span class="type">Image</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">options</code>
                        <span class="type">Object</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>:
                    
                    <p>the texture</p>

                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_Texture.cubemapFromImages" class="method item">
    <h3 class="name"><code>Texture.cubemapFromImages</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>images</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>options</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l505"><code>..&#x2F;src&#x2F;texture.js:505</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Create a cubemap texture from a set of 6 images</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">images</code>
                        <span class="type">Array</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">options</code>
                        <span class="type">Object</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>:
                    
                    <p>the texture</p>

                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_Texture.fromImage" class="method item">
    <h3 class="name"><code>Texture.fromImage</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>image</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>options</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l405"><code>..&#x2F;src&#x2F;texture.js:405</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Create a texture from an Image</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">image</code>
                        <span class="type">Image</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">options</code>
                        <span class="type">Object</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>:
                    
                    <p>the texture</p>

                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_Texture.fromTexture" class="method item">
    <h3 class="name"><code>Texture.fromTexture</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>width</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>height</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>pixels</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>options</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l467"><code>..&#x2F;src&#x2F;texture.js:467</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Create a texture from an ArrayBuffer containing the pixels</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">width</code>
                        <span class="type">Number</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">height</code>
                        <span class="type">Number</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">pixels</code>
                        <span class="type">ArrayBuffer</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">options</code>
                        <span class="type">Object</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>:
                    
                    <p>the texture</p>

                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_Texture.fromTexture" class="method item">
    <h3 class="name"><code>Texture.fromTexture</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>old_texture</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>options</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l453"><code>..&#x2F;src&#x2F;texture.js:453</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Create a clone of a texture</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">old_texture</code>
                        <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">options</code>
                        <span class="type">Object</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>:
                    
                    <p>the texture</p>

                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_Texture.fromURL" class="method item">
    <h3 class="name"><code>Texture.fromURL</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>url</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>options</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>on_complete</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l358"><code>..&#x2F;src&#x2F;texture.js:358</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Loads and uploads a texture from a url</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">url</code>
                        <span class="type">String</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">options</code>
                        <span class="type">Object</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">on_complete</code>
                        <span class="type">Function</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>:
                    
                    <p>the texture</p>

                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_Texture.fromVideo" class="method item">
    <h3 class="name"><code>Texture.fromVideo</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>video</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>options</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l429"><code>..&#x2F;src&#x2F;texture.js:429</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Create a texture from a Video</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">video</code>
                        <span class="type">Video</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">options</code>
                        <span class="type">Object</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type"><a href="../classes/Texture.html" class="crosslink">Texture</a></span>:
                    
                    <p>the texture</p>

                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_Texture.toBase64" class="method item">
    <h3 class="name"><code>Texture.toBase64</code></h3>

    
        <span class="paren">()</span>
    

    
        <span class="returns-inline">
            <span class="type">String</span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l607"><code>..&#x2F;src&#x2F;texture.js:607</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>returns a base64 String containing all the data from the texture</p>

    </div>

    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">String</span>:
                    
                    <p>the data in base64 format</p>

                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_Texture.toBlob" class="method item">
    <h3 class="name"><code>Texture.toBlob</code></h3>

    
        <span class="paren">()</span>
    

    
        <span class="returns-inline">
            <span class="type">Blob</span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l571"><code>..&#x2F;src&#x2F;texture.js:571</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>returns a Blob containing all the data from the texture</p>

    </div>

    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Blob</span>:
                    
                    <p>the blob containing the data</p>

                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_toCanvas" class="method item">
    <h3 class="name"><code>toCanvas</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>canvas</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l270"><code>..&#x2F;src&#x2F;texture.js:270</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Copy texture content to a canvas</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">canvas</code>
                        <span class="type">Canvas</span>
                    

                    

                    <div class="param-description">
                        <p>must have the same size, if different the canvas will be resized</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    

    
</div>

                
                    <div id="method_toViewport" class="method item">
    <h3 class="name"><code>toViewport</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>shader</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>uniforms</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l254"><code>..&#x2F;src&#x2F;texture.js:254</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Render texture in a quad to full viewport size</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">shader</code>
                        <span class="type"><a href="../classes/Shader.html" class="crosslink">Shader</a></span>
                    

                    

                    <div class="param-description">
                        <p>to apply, otherwise a default textured shader is applied</p>

                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">uniforms</code>
                        <span class="type">Object</span>
                    

                    

                    <div class="param-description">
                        <p>for the shader if needed</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    

    
</div>

                
                    <div id="method_unbind" class="method item">
    <h3 class="name"><code>unbind</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>unit</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type">Number</span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l119"><code>..&#x2F;src&#x2F;texture.js:119</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Unbinds the texture</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">unit</code>
                        <span class="type">Number</span>
                    

                    

                    <div class="param-description">
                        <p>texture unit</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Number</span>:
                    
                    <p>returns the texture unit</p>

                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_uploadData" class="method item">
    <h3 class="name"><code>uploadData</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>data</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l164"><code>..&#x2F;src&#x2F;texture.js:164</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Uploads data to the GPU (data must have the appropiate size)</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">data</code>
                        <span class="type">ArrayBuffer</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    

    
</div>

                
                    <div id="method_uploadImage" class="method item">
    <h3 class="name"><code>uploadImage</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>img</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/.._src_texture.js.html#l136"><code>..&#x2F;src&#x2F;texture.js:136</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Given an Image/Canvas/Video it uploads it to the GPU</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">img</code>
                        <span class="type">Image</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    

    
</div>

                
            </div>
        

        

        

        
    </div>
</div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
